package twu.shuhbam.library;

import org.junit.Test;
import twu.shubham.library.BookRecord;

import static org.junit.Assert.assertEquals;


public class BookRecordTests {

    BookRecord book = new BookRecord(2,"a");
    @Test
    public void forSerialNoGreaterThanZeroBookWillBePrinted() throws Exception {


        assertEquals(1, book.bookPrint(1));
    }
    @Test
    public void forSerialNoZeroOrLessBookWillNotBePrinted() throws Exception {


        assertEquals(0, book.bookPrint(0));
    }

    @Test
    public void forCurrentAmountGreaterThanZeroBookWillBeIssued() throws Exception {


        assertEquals(1, book.reserveBook(1));
    }

    BookRecord book1 = new BookRecord(0,"b");

    @Test
    public void forCurrentAmountEqualsToZeroBookWillNotBeIssued() throws Exception {


        assertEquals(0, book1.reserveBook(1));
    }

    @Test
    public void forCurrentAmountEqualsToActualAmountBookWillNotBeReturned() throws Exception {


        assertEquals(0, book.returnBook());
    }

    @Test
    public void forCurrentAmountLessThanActualAmountBookWillBeReturned() throws Exception {


        book.reserveBook(1);
        assertEquals(1, book.returnBook());
    }
}
